/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package escr.persistencia;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Aditardo
 */
@Entity
@Table(name = "submenu")
@NamedQueries({@NamedQuery(name = "Submenu.findByIdsubMenu", query = "SELECT s FROM Submenu s WHERE s.idsubMenu = :idsubMenu"), @NamedQuery(name = "Submenu.findByNombreSubmenu", query = "SELECT s FROM Submenu s WHERE s.nombreSubmenu = :nombreSubmenu")})
public class Submenu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "idsubMenu", nullable = false)
    private Integer idsubMenu;
    @Column(name = "nombreSubmenu")
    private String nombreSubmenu;
    @JoinColumn(name = "idTitumenu", referencedColumnName = "idTitumenu")
    @ManyToOne
    private Titulomenu idTitumenu;

    public Submenu() {
    }

    public Submenu(Integer idsubMenu) {
        this.idsubMenu = idsubMenu;
    }

    public Integer getIdsubMenu() {
        return idsubMenu;
    }

    public void setIdsubMenu(Integer idsubMenu) {
        this.idsubMenu = idsubMenu;
    }

    public String getNombreSubmenu() {
        return nombreSubmenu;
    }

    public void setNombreSubmenu(String nombreSubmenu) {
        this.nombreSubmenu = nombreSubmenu;
    }

    public Titulomenu getIdTitumenu() {
        return idTitumenu;
    }

    public void setIdTitumenu(Titulomenu idTitumenu) {
        this.idTitumenu = idTitumenu;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsubMenu != null ? idsubMenu.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Submenu)) {
            return false;
        }
        Submenu other = (Submenu) object;
        if ((this.idsubMenu == null && other.idsubMenu != null) || (this.idsubMenu != null && !this.idsubMenu.equals(other.idsubMenu))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "escr.persistencia.Submenu[idsubMenu=" + idsubMenu + "]";
    }

}
